using UnityEngine;
using UnityEngine.UI;

public class ConnectingEvent : MonoBehaviour
{
	public Text TextInfo;

	public float Timeout = 10f;

	public GameObject Preloading;

	private float timeTemp;

	private bool conneted;

	private void OnEnable()
	{
		if ((bool)Preloading)
		{
			Preloading.SetActive(value: true);
		}
		conneted = false;
		timeTemp = Time.time;
		if ((bool)TextInfo)
		{
			TextInfo.text = "Connecting to server";
		}
	}

	private void Start()
	{
	}

	private void Update()
	{
		if (!conneted && Time.time >= Timeout + timeTemp)
		{
			if ((bool)TextInfo)
			{
				TextInfo.text = "Connecting Time out";
			}
			if ((bool)Preloading)
			{
				Preloading.SetActive(value: false);
			}
		}
	}
}
